<template>
  <div>
    <!-- 日记单元 -->
    <div class="diary">
      <div class="da-title">
        <div class="user">
          <img :src="item.userAvatar" alt="" class="head-img" />
          <span>{{item.userName}}</span>
        </div>
        <div class="city">{{item.diaryCity}}</div>
      </div>
      <p class="content">
        {{item.diaryArticle}}
      </p>
      <img :src="item.diaryCover" alt="" class="cover" />
      <!-- <img :src="item.avatar" alt="" class="cover"> -->
    </div>
  </div>
</template>

<script>
export default {
  props: ["item"],
  methods: {
    goDetails() {
      this.$router.push("/details");
    },
  },
};
</script>

<style lang="scss" scoped>
// 日记单元
.diary {
  width: 90vw;
  margin: auto;
  border-radius: 3vw;
  box-shadow: 0px 0px 6px #ccc;
  text-align: center;
  margin-bottom: 4vw;
  background-color: #fff;
  .da-title {
    width: 90%;
    height: 10vw;
    line-height: 10vw;
    display: flex;
    margin: auto;
    justify-content: space-between;
    margin-bottom: 6vw;
    padding-top: 3vw;
    .user {
      .head-img {
        width: 10vw;
        border-radius: 50%;
        margin-right: 2vw;
      }
      span {
        color: #000;
        font-size: 1em;
        font-weight: bold;
      }
    }
    .city {
      color: #a7a7a7;
      font-size: 0.8em;
    }
  }
  .content {
    margin: auto;
    width: 90%;
    height: 6vw;
    line-height: 6vw;
    font-size: 0.9em;
    overflow: hidden;
    white-space: nowrap; //强制不换行
    text-overflow: ellipsis;
    margin-bottom: 3vw;
  }
  .cover {
    width: 90%;
    border-radius: 3vw;
    margin-bottom: 5vw;
  }
}
</style>